package cate.game.play.skill.brother;

import cate.common.table.d.GDSkill;
import cate.game.play.proce.action.ctx.SkillActionCtx;

import java.util.List;

public class BrotherHandler {

	public static List<Integer> select(Byte mode, String code, SkillActionCtx action) {
		BrotherSkillSelector selector = build(mode, code);
		if (selector != null) {
			return selector.select(action);
		}
		return null;
	}

	private static BrotherSkillSelector build(Byte mode, String code) {
		BrotherSkillSelector select = createSelect(mode);
		if (select != null) {
			select.parse(code);
		}
		return select;
	}

	private static BrotherSkillSelector createSelect(Byte mode) {
		if (mode == null) {
			return null;
		}
		switch (mode) {
			case GDSkill.BrotherMode.DEFAULT:
				return new DefaultBS();
			case GDSkill.BrotherMode.NO_TARGET:
				return new NoTargetBS();
			case GDSkill.BrotherMode.HERO_NUM:
				return new HeroNumBS();
			case GDSkill.BrotherMode.CHANCE:
				return new ChanceBS();
			case GDSkill.BrotherMode.RELATIVE_NUM:
				return new RelativeNumBS();
			default:
				return null;
		}
	}
}
